<template>
  <div id="app">
    <mt-tabbar class="bar" v-if="$route.meta.showTabbar" v-model="selected">
      <mt-tab-item id="recommend">
        <img
          slot="icon"
          src="./assets/recommended.svg"
          v-show="selected != 'recommend'"
        />
        <img
          slot="icon"
          src="./assets/recommended_activate.svg"
          v-show="selected == 'recommend'"
        />
        推荐
      </mt-tab-item>
      <mt-tab-item id="category">
        <img
          slot="icon"
          src="./assets/info.svg"
          v-show="selected != 'category'"
        />
        <img
          slot="icon"
          src="./assets/info_activate.svg"
          v-show="selected == 'category'"
        />
        消息
      </mt-tab-item>
      <mt-tab-item id="Find">
        <img
          slot="icon"
          src="./assets/find.svg"
          v-show="selected != 'Find'"
        />
        <img
          slot="icon"
          src="./assets/find_activate.svg"
          v-show="selected == 'Find'"
        />
        发现
      </mt-tab-item>
      <mt-tab-item id="mine">
        <img
          slot="icon"
          src="./assets/me.svg"
          v-show="selected != 'mine'"
        />
        <img
          slot="icon"
          src="./assets/me_activate.svg"
          v-show="selected == 'mine'"
        />
        我的
      </mt-tab-item>
    </mt-tabbar>

    <router-view></router-view>
  </div>
</template>
<style lang='scss'>
::-webkit-scrollbar{
  display: none;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
}
body {
  margin: 0;
}
.pageBody .mint-field {
  width: 100%;
  .mint-cell:last-child {
    background: none;
  }
  .mint-cell-wrapper {
    background: none;
  }
}
.Page {
  height: calc(100vh - 55px);
  display: flex;
  flex-flow: column;
}
.PageA {
  height: 100vh;
  text-align: center;
}
.Header {
  height: 40px;
  background-color: brown;
}

.content {
  flex: 1;
  box-sizing: border-box;
  height: calc(100vh - 105px);
  display: flex;
  flex-flow: column;
  overflow-y: scroll;
}
.contentC {
  flex-flow: column;
  display: flex;
}
.TopMargin {
  margin-top: 50px;
}
</style>

<script>
export default {
  name: "App",
  data() {
    return {
      selected: "recommend",
    };
  },

  watch: {
    selected(newVal) {
      if (newVal == "recommend") {
        //切换到首页路由
        this.$router.push("/recommend");
      } else if (newVal == "category") {
        this.$router.push("/info");
      } else if (newVal == "Find") {
        this.$router.push("/Find");
      } else if (newVal == "mine") {
        this.$router.push("/mine");
      }
    },
  },
};
</script>
